<?php

namespace App\Abstracts\Models;



use Hilaoyu\LaravelExtend\Model;

abstract class AbstractModelVariables extends Model
{
    protected $table = 'variables';


    protected $fillable = [
        'name',
        'key',
        'value',
        'remarks',
        'required',
    ];

    protected $casts = [
      'value'=>'json',
      'required'=>'int',
    ];

    public function usesTimestamps()
    {
        return false;
    }

    /*
     * 验证规则
     * */
    public function getValidationRules()
    {
        $rules =  [
            'key' => 'required|string|max:100|unique:'. static::getTableCon() .',key,' . $this->getOriginalKey() . ',' . static::getPkName(),
        ];

        return $rules;
    }
}
